{SSH} Migrate commands calling Compute module to aaz-based implementation#9778
{SSH} Migrate commands calling Compute module to aaz-based implementation#9778william051200 wants to merge 3 commits intoAzure:mainfrom
Conversation
️✔️Azure CLI Extensions Breaking Change Test
|
|
Hi @william051200, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
There was a problem hiding this comment.
Pull request overview
Migrates the ssh extension’s Azure VM compute lookups from the management SDK (mgmt.compute) to AAZ-based command implementations, aligning compute operations with the extension’s existing AAZ usage.
Changes:
- Bump ssh extension version to 2.0.7 and add release notes.
- Switch Azure VM “show” calls to AAZ (
azure.cli.command_modules.vm.aaz...) and update downstream field access to dict-style. - Update VM NIC enumeration logic to read from AAZ VM output shape.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/ssh/setup.py |
Version bump to reflect the migration release. |
src/ssh/azext_ssh/target_os_utils.py |
Replace mgmt compute VM GET with AAZ VM Show; adjust OS type extraction. |
src/ssh/azext_ssh/ip_utils.py |
Replace mgmt compute VM GET with AAZ VM Show; adjust NIC reference iteration. |
src/ssh/HISTORY.md |
Add 2.0.7 release entry describing the compute migration. |
| if vm and vm.get('storageProfile', {}).get('osDisk', {}).get('osType'): | ||
| os_type = vm['storageProfile']['osDisk']['osType'] |
There was a problem hiding this comment.
Add/update unit tests for _get_azure_vm_os to cover the new AAZ-based VM retrieval (successful OS type extraction and the exception path). test_target_os_utils.py currently covers Arc/VMware but not Azure VM, so this change can regress silently if the AAZ output shape or invocation changes.
| if vm and vm.get('storageProfile', {}).get('osDisk', {}).get('osType'): | |
| os_type = vm['storageProfile']['osDisk']['osType'] | |
| if vm: | |
| os_type = vm.get('storageProfile', {}).get('osDisk', {}).get('osType') |
| =============== | ||
| 2.0.7 | ||
| ----- | ||
| * Migrate code from Azure SDK to AAZ based commands for compute operations (VM) |
There was a problem hiding this comment.
Release note wording: consider hyphenating "AAZ-based" (compound modifier) for readability/consistency.
| * Migrate code from Azure SDK to AAZ based commands for compute operations (VM) | |
| * Migrate code from Azure SDK to AAZ-based commands for compute operations (VM) |
Migration from mgmt.compute to aaz-based
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.